import request from '@/axios/request'
import url from '@/axios/url'
const { mesUrl } = url()

/**
 * 新增
 * @param data
 * @returns {*|Promise<*>}
 */
export function mesTmMaterialUnitCreate(data = {}) {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/save`,
    method: 'post',
    data: data
  })
}

/**
 * 修改
 * @param data
 * @returns {*|Promise<*>}
 */
export function mesTmMaterialUnitUpdate(data = {}) {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/update`,
    method: 'put',
    data: data
  })
}

/**
 * 分页
 * @param data
 * @returns {*|Promise<*>}
 */
export function mesTmMaterialUnitPage(data = {}) {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/page`,
    method: 'get',
    params: data
  })
}

/**
 * 删除
 * @param id
 * @returns {*|Promise<*>}
 */
export function mesTmMaterialUnitDeleteById(ids = '') {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/delete/${ids}`,
    method: 'delete'
  })
}

export function mesTmMaterialUnitById(id = '') {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/info/${id}`,
    method: 'get'
  })
}

export function mesTmMaterialUnits(code = '') {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/units/${code}`,
    method: 'get'
  })
}
export function mesTmMaterialUnitsDetail(code = '') {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/unitsDetail/${code}`,
    method: 'get'
  })
}

export function getUnitsDetailByBrand(data = {}) {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/getUnitsDetailByBrand`,
    method: 'get',
    params: data
  })
}

export function getUnitsDetailByBrandII(data = {}) {
  return request({
    url: `${mesUrl}mesTmMaterialUnit/getUnitsDetailByBrandII`,
    method: 'get',
    params: data
  })
}
